﻿//////////////////////////////////////////////////////////////////////////////
//
// Copyright © 1998-2024 Glodon Company Limited.
//
// Licensed under the MIT License
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the “Software”),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//////////////////////////////////////////////////////////////////////////////
#pragma once

#include "GmUiCommonComponent.h"

namespace gcmp
{
    class IParameterDisplay;
    class IParameterValueList;
    class UniIdentity;

    /// \brief 参数显示类
    ///
    /// 描述参数在界面上以某种控件呈现的相关信息的类，比如可以用Checkbox, Editbox的形式表示参数
    class GM_UI_COMMON_COMPONENT_EXPORT IParameterDisplay
    {
    public:
        /// \brief 析构函数
        virtual ~IParameterDisplay() {}

        /// \brief 返回参数的跨文档标识符
        ///
        /// \return 跨文档标识符
        virtual const UniIdentity& GetParameterDefinitionUid() const = 0;

        /// \brief 根据给定参数标识符，创建相关参数将以控件Checkbox呈现的显示对象
        ///
        /// \param uid 参数跨文档标识符
        /// \return  参数显示类对象
        static OwnerPtr<IParameterDisplay> CreateParameterDisplayCheckbox(const UniIdentity &uid);

        /// \brief 根据给定参数标识符，创建相关参数将以控件Dropdown List呈现的显示对象
        ///
        /// \param uid       参数跨文档标识符
        /// \param pValueList 参数值列表
        /// \return     参数显示类对象
        static OwnerPtr<IParameterDisplay> CreateParameterDisplayDropdownList(const UniIdentity &uid, OwnerPtr<IParameterValueList> pValueList);

        /// \brief 根据给定参数标识符，创建相关参数将以控件Editbox呈现的显示对象
        ///
        /// \param uid 参数跨文档标识符
        /// \return     参数显示类对象
        static OwnerPtr<IParameterDisplay> CreateParameterDisplayEditbox(const UniIdentity &uid);

        /// \brief 根据给定参数标识符，创建相关参数将以控件Editbox和Button呈现的显示对象
        ///
        /// \param uid 参数跨文档标识符
        /// \return     参数显示类对象
        static OwnerPtr<IParameterDisplay> CreateParameterDisplayEditboxWithButton(const UniIdentity &uid);
    
        /// \brief 根据给定参数标识符，创建相关参数将以带扩展项控件Dropdown List呈现的显示对象
        ///
        /// \param uid       参数跨文档标识符
        /// \param pValueList 参数值列表
        /// \param externalItemDisplayString 扩展项显示字符串
        /// \return     参数显示类对象
        static OwnerPtr<IParameterDisplay> CreateParameterDisplayDropdownListWithExternalItem(const UniIdentity &uid, OwnerPtr<IParameterValueList> pValueList, std::wstring externalItemDisplayString = L"");
    };
}

